﻿using System;
using Kiwi.Container.DependencyInjection;
using Kiwi.Container.Lifetime;
using Kiwi.Container.Scope;

namespace Kiwi.Container.Registration
{
    public class ComponentRegistration<T, C> : IComponentRegistration<T> where C : T
    {
        public ComponentRegistration(IComponentActivator<C> activator)
        {
            if (activator == null)
            {
                throw new ArgumentNullException("activator", "The component activator must not be null.");
            }
            Activator = activator;
        }

        #region IComponentRegistration<T> Members

        public Type ActualType
        {
            get { return typeof (T); }
        }

        public IComponentType ComponentType { get; set; }

        public IComponentScope ComponentScope { get; set; }

        public object Tag { get; set; }

        public IEnumerateDependentProperties InjectProperties { get; set; }

        public IComponentCacheResolver CacheResolver { get; set; }

        public ILifetimeManager LifetimeManager { get; set; }

        public IComponentActivator Activator { get; private set; }

        #endregion
    }
}